/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package luft27.comm.dozor;

/**
 *
 * @author amalikov
 */
public class Packet {
	public Packet(byte addr, byte id, byte[] data) {
		this.addr = addr;
		this.id = id;
		this.data = data;
	}
	
	public final byte addr;
	public final byte id;
	public final byte[] data;
	
	@Override
	public String toString() {
		StringBuilder sb = new StringBuilder();
		sb.append(String.format("zorlink addr=%d id=%d payload=[", 
				(short)addr & 0xFF, (short)id & 0xFF));
		for (byte p : data) {
			sb.append(" ");
			sb.append((short)p & 0xFF);
		}
		sb.append(" ]");
		return sb.toString();
	}	
}
